<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>v-on指令</title>
    <style type="text/css">
        .div1 {
            width: 100px;
            height: 100px;
            background: red;
            margin-top: 20px;
        }
        .button {
            padding: 10px 20px;
            border: none;
            background-color: green;
            color: #fff;
            border-radius: 5px;
        }
    </style>
</head>
<body>
    <div id="app">
        <button v-on:click='fn'>toggle</button>
        <!-- v-on可以简写成@ -->
        <!--<button @click='fn'>toggle</button>-->
        <div class="div1" v-show='bol'></div>
    </div>
    <script src="../js/vue.min.js"></script>
    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                bol: false
            },
            methods: {
                fn: function () {
                    this.bol = !this.bol;
                }
            }
        })
    </script>
</body>
</html>